package migrations

import (
	"github.com/goravel/framework/contracts/database/schema"
	"github.com/goravel/framework/facades"
)

type M20250703080220CreateSysNotificationTable struct {
}

// Signature The unique signature for the migration.
func (r *M20250703080220CreateSysNotificationTable) Signature() string {
	return "20250703080220_create_sys_notification_table"
}

// Up Run the migrations.
func (r *M20250703080220CreateSysNotificationTable) Up() error {
	if !facades.Schema().HasTable("sys_notification") {
		return facades.Schema().Create("sys_notification", func(table schema.Blueprint) {
			table.ID()
			table.String("title").Comment("标题")
			table.SmallInteger("type").Default(0).Comment("类型")
			table.SmallInteger("status").Default(0).Comment("状态")
			table.Integer("creator_id").Default(0).Comment("创建人ID")
			table.String("creator_name").Default("").Comment("创建人名称")
			table.Text("content").Comment("内容")
			table.TimestampsTz()
		})
	}
	return nil
}

// Down Reverse the migrations.
func (r *M20250703080220CreateSysNotificationTable) Down() error {
	return facades.Schema().DropIfExists("sys_notification")
}
